package com.chenfei.sharding.jdbc.controller;

import com.chenfei.domain.Test;
import com.chenfei.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;


/**
 * @author chenfei
 * @description
 * @since 2018/2/27
 */
@RestController
@RequestMapping(value = "/service")
@Slf4j
public class MybatisController {
    @Autowired
    TestService testService;
    @Autowired
    RestTemplate restTemplate;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public Object listAccount() {
        log.info("begin cat");
        List<Test> list = testService.list();
        String result = restTemplate.getForObject("http://192.168.8.179:18081/main",String.class);
        log.info(result);
        log.info("end cat");
        return list;
    }
}
